<script setup lang="ts">
import { defineProps } from 'vue'
import type { hotItem } from '@/types/home'
defineProps<{
  list: hotItem[]
}>()
</script>

<template>
  <view class="hot">
    <view class="hot-item" v-for="item in list" :key="item.id">
      <view class="title-box">
        <text class="title">{{ item.title }}</text>
        <text class="sub-title">{{ item.alt }}</text>
      </view>
      <navigator hover-class="none" :url="`/pages/hot/hot?type=${item.type}`" class="cards">
        <image class="image" mode="aspectFit" :src="i" v-for="i in item.pictures" :key="i"></image>
      </navigator>
    </view>
  </view>
</template>

<style lang="scss">
.hot {
  display: flex;
  flex-wrap: wrap;
  width: calc(100% - 40rpx);
  margin: 20rpx;
  // padding: 10rpx;
  box-sizing: border-box;
  min-height: 508rpx;
  background-color: #fff;
  .hot-item {
    display: flex;
    // 主轴方向：上到下对其，row是左到右对齐
    flex-direction: column;
    width: 50%;
    height: 254rpx;

    border-right: 1rpx solid #eee;
    border-top: 1rpx solid #eee;
    .title-box {
      padding: 24rpx 24rpx 0;
      font-size: 32rpx;
      color: #262626;
      position: relative;
      .sub-title {
        font-size: 24rpx;
        color: #7f7f7f;
        margin-left: 18rpx;
      }
    }
    .cards {
      display: flex;
      justify-content: center;
      align-items: center;
      width: 100%;
      // border: 1px solid yellow;
      padding: 15rpx 20rpx;
    }

    .image {
      width: 150rpx;
      height: 150rpx;
      margin-right: 15rpx;
      // border: 1px solid red;
    }
    .cards .image:nth-child(2n) {
      margin-right: 0rpx;
    }
  }
}
</style>
